﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.burry.services.SizeService" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bary</title>
<!--Script and CSS includes for YUI dependencies on this page-->
<link rel="stylesheet" type="text/css" href="Resource/yui/build/tabview/assets/skins/sam/tabview.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/button/assets/skins/sam/button.css" />
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/css.css">
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/good.css">
<script type="text/javascript" src="Resource/yui/build/yuiloader/yuiloader.js"></script>
<script type="text/javascript" src="Resource/yui/build/event/event-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/dom/dom-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/element/element-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/tabview/tabview-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/button/button-min.js"></script>
<script language="JavaScript" type="text/JavaScript" src="Resource/js/cs.js"></script>
<script language="JavaScript" type="text/JavaScript" src="Resource/js/core.js"></script>
<script language="JavaScript" type="text/JavaScript">
var goodId = null;

var aryPType = new Array();
<s:property value="selectStr" escape="false"/>

</script>
</head>
<body id="yahoo-com" class=" yui-skin-sam">
<form name="goodForm" method="post" action="addAGood.do">
	<input type="hidden" name="inputGoodId" id="inputGoodId" />
	<input type="hidden" name="inputFea" id="inputFea" />
  <div id="framed">
    <h2>商品发布</h2>
    <div id="fright"> 我发布产品所属品牌:
      <select name="selP1" id="selP1" onchange="cs1.change(this)" subElement="selP2">
      </select>
    </div>
  </div>
  <div>
    <div id="demo" class="yui-navset">
      <ul class="yui-nav">
        <li class="selected"><a href="#tab1"><em>产品所属类别选择</em></a></li>
        <li><a href="#tab2"><em>产品通用数据录入</em></a></li>
      </ul>
      <div class="yui-content">
        <div id="tab1">
          <p>发布产品所属类别</p>
          <div> <br />
            <select name="selP2" id="selP2" onchange="cs2.change(this)" subElement="selP3">
            </select>
            &nbsp;
            <select name="selP3" id="selP3" onchange="cs3.change(this)" subElement="selP4">
            </select>
            &nbsp;
            <select name="selP4" id="selP4" onchange="cs4.change(this)" subElement="selP5">
            </select>
            &nbsp;
            <select name="selP5" id="selP5" >
            </select>
            <br />
            <br />
            <br />
            <input type="button" onclick="saveInfo()" value="保存" />
          </div>
        </div>
        <div id="tab2">
          <div class="line_pubForm">
            <table width="100%" style="tabSty">
            	<tr>
                <td width=120 align=right>产品简称：</td>
                <td align=left><input type="text" id="sname" name="sname" onblur="buildCode()" class="iptSty" >
                  &nbsp;&nbsp; 
              </tr>
              <tr>
                <td width=120 align=right>产品名称：</td>
                <td align=left><input type="text" name="cname" class="iptSty" >
                  &nbsp;&nbsp; 
              </tr>
            </table>
            <div class="pubtips" style="display:block;">你录入的产品编号为：<span id="goodIda"></span> </div>
          </div>
          <div class="line_pubForm">
            <table width="100%" style="tabSty">
              <tr>
                <td width=120 align=right>产品特性：</td>
                <td align=left><select name="tags" id="tags">
                    <option selected>材质</option>
                    <option>面料</option>
                    <option>细节</option>
                  </select>
                </td>
              </tr>
              <tr>
                <td width=120 align=right>特性内容：</td>
                <td align=left><textarea id="feaContent" class="txtarea" rows=4 cols=40 name="" value=""></textarea> &nbsp; <input type="button" value="增加" onclick="addFeature()" /> &nbsp; <input type="button" value="重置" onclick="resetFea()" /></td>
              </tr>
            </table>
            <div class="pubtips" style="display:block;">
              <div>你录入的产品特性为：</div>
              
              <div id="feaDiv">
              	
              	
              </div>
              
            </div>
          </div>
          <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>产品简介：</td>
                <td align=left><textarea class="txtarea" rows=1 cols=40 name="goodIntro" value=""></textarea>
                  &nbsp;&nbsp;</td>
              </tr>
            </table>
            
          </div>
          
          <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>商品标签：</td>
                <td align=left><textarea class="txtarea" rows=1 cols=40 name="goodTag" value=""></textarea>
                  &nbsp;&nbsp;</td>
              </tr>
            </table>
            
          </div>
          
          <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>销售扼要说明：</td>
                <td align=left><textarea class="txtarea" rows=1 cols=40 name="goodSell" value=""></textarea>
                  &nbsp;&nbsp;</td>
              </tr>
            </table>
            
          </div>
          
          
          <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>产品详细介绍：</td>
                <td align=left><textarea class="txtarea" rows=4 cols=40 name="goodDes" value=""></textarea>
                  &nbsp;&nbsp;非填项&nbsp;&nbsp;
                  
              </tr>
            </table>
           
          </div>
          <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>设计与工艺：</td>
                <td align=left><textarea class="txtarea" rows=4 cols=40 name="goodDesign" value=""></textarea>
                  &nbsp;&nbsp;非填项&nbsp;&nbsp;
                 
              </tr>
            </table>
            
          </div>
          
           <div class="line_pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>产品价格：</td>
                <td align=left>
                		现价：<input name="cPrice" type="text" /><br/>
                		原价：<input name="oPrice" type="text" /><br/>
                		市场价：<input name="mPrice" type="text" /><br/>
                		同类产品市场价：<input name="sPrice" type="text" />
                	</td>
                 
              </tr>
            </table>
            
          </div>
          
          
          <div class="pubForm">
            <table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right>产品尺码表：</td>
                <td align=left><select name="goodSize">
                	<%
                		SizeService ss = new SizeService();
                		List ssList = ss.getAllSizeInfo();
                		for(int i=0;i<ssList.size();i++){
                			Map t = (Map)ssList.get(i);
                			out.println("<option value='" +t.get("id")+ "'>" +t.get("cname")+ "</option>");
                		}
                	%>
                    
                  </select>
                  &nbsp;
                  
                </td>
              </tr>
            </table>
            
          </div>
          <div class="line_pubForm">
          	
          	<table cellpadding=0 cellspacing=0 border=0 width="100%" style="tabSty">
              <tr>
                <td width=120 align=right valign=top>	<input type="button" onclick="checkAndSubmit()" value="保存" />&nbsp;</td>
                <td align=left><input type="button" onclick="returnBefore()" value="返回" />
              </tr>
            </table>
            
         
            
          </div>
        </div>
      </div>
    </div>
    
    <input type="hidden" name="cataCode" id="cataCode" />
    <script>

var tabView = new YAHOO.widget.TabView('demo');

function saveInfo(){
	var tab2 = tabView.getTab("1");
	tabView.set('activeTab', tab2, true);	
}

function returnBefore(){
	var tab1 = tabView.getTab("0");
	tabView.set('activeTab', tab1, true);	
}

function buildCode(){
	var n = 6;
	var cataValue = null;
	for(var i=1;i<n;i++){
			var selObj = $("selP"+i);
			//alert(selObj);
			if(selObj && selObj.value != "")
				cataValue = selObj.value;
		}
	var goodIda = $("goodIda");
	$("cataCode").value = cataValue;
	var goodIdStr = cataValue + $("sname").value;
	$("inputGoodId").value = goodIdStr;
	goodIda.innerHTML = goodIdStr;
}


function addFeature(){
	var tag = $("tags");
	
	var feaContent = $("feaContent");
	
	var feaStr = "<div><span class=\"imptxt\">" + tag.value + ":" + feaContent.value + "</span>&nbsp;&nbsp;</div>"
	var feaDiv = $("feaDiv");
	feaDiv.innerHTML = feaDiv.innerHTML + feaStr;
	var inputFea = $("inputFea").value;
	$("inputFea").value = inputFea + ";" + tag.value + ":" + feaContent.value;
}

function resetFea(){
	
	var feaDiv = $("feaDiv");
	$("inputFea").value = "";
	feaDiv.innerHTML = "";
}

function checkAndSubmit(){
	//alert($("inputFea").value);
	document.goodForm.submit();
}

cs1 = new CascadeSelect(document.goodForm.selP1, aryPType, '-1');
cs2 = new CascadeSelect(document.goodForm.selP2, aryPType, document.goodForm.selP1.options[document.goodForm.selP1.selectedIndex].value);
cs3 = new CascadeSelect(document.goodForm.selP3, aryPType, document.goodForm.selP2.options[document.goodForm.selP2.selectedIndex].value);
cs4 = new CascadeSelect(document.goodForm.selP4, aryPType, document.goodForm.selP3.options[document.goodForm.selP3.selectedIndex].value);

</script>
  </div>
</form>
</body>
</html>
